<template>
  <div>
    <a href="http://www.baidu.com" @click.prevent>百度</a>
    <div class="father" @click="fn">
      <div class="son" @click.stop="fn2"></div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  methods: {
    fn() {
      console.log("父元素被点击了");
    },
    fn2() {
      console.log("子元素被点击了");
    },
  },
};
</script>

<style scoped>
.son {
  width: 100px;
  height: 100px;
  background: pink;
}
.father {
  margin-top: 100px;
  padding: 130px;
  background-color: blue;
  float: left;
}
</style>
